/**
 * 
 */
package org.rollinitiative.d20.entity;

import org.rollinitiative.d20.schema.d20.AbilityEnum;

/**
 * Enumeration of an Actor's characteristic abilities, as per the D20 SRD.
 * 
 * @author jmccormi
 * 
 */
public enum Ability {
	STR, DEX, CON, INT, WIS, CHA;

	public static Ability mapAbility(AbilityEnum ability) {
		int abilVal = ability.enumValue().intValue();
		switch (abilVal) {
		case AbilityEnum.INT_STR:
			return STR;
		case AbilityEnum.INT_DEX:
			return DEX;
		case AbilityEnum.INT_CON:
			return CON;
		case AbilityEnum.INT_INT:
			return INT;
		case AbilityEnum.INT_WIS:
			return WIS;
		case AbilityEnum.INT_CHA:
			return CHA;
		default:
			return STR;
		}
	}
	
	/**
	 * Returns the ability modifier for the provided value
	 * 
	 * @param value
	 * @return modifier
	 * @since incr-0.1
	 */
	public static int getModifier(int value) {
		return (value / 2 - 5);
	}
}
